package app

import (
	"github.com/gin-gonic/gin"
	"jenkin/websocket-go/app/ws"
)

func Init() *gin.Engine {
	router := gin.Default()
	gin.SetMode(gin.ReleaseMode)
	web := router.Static("/web", "web")
	web.GET("/", func(context *gin.Context) {
		context.File("./web/index.html")
	})
	var websocket ws.Websocket

	// 设置WebSocket路由处理函数
	router.GET("/ws", websocket.WebsocketHandler)

	return router
}
